package com.lst.tools.basics.utils;

import java.util.UUID;

/**
 * 随机数工具类
 *
 * @author: Frank
 * @date: 2019/09/24 13:51
 * @version: V1.0
 */
public class RandomUtils {
    public static String createRandom(int len) {
        String str = UUID.randomUUID().toString().replaceAll("[a-zA-Z]|-", "");
        int length = str.length();
        len = length > len ? len : length;
        return str.substring(0, len);
    }

    public static String createRandomChar(int len) {
        String str = UUID.randomUUID().toString().replaceAll("-", "");
        int length = str.length();
        len = length > len ? len : length;
        return str.substring(0, len);
    }

    public static String createNonceStr() {
        return UUID.randomUUID().toString().replace("-", "");
    }
}
